<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>标题</title> 
<link href="./css/ionic.css" rel="stylesheet"> 
<script src="./js/ionic.bundle.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myAppController">
	<button class="button button-dark" ng-click="showPopup()">
	弹窗显示
	</button>

	<button class="button button-primary" ng-click="showConfirm()">
	确认对话框
	</button>

	<button class="button button-positive" ng-click="showAlert()">
	警告框
	</button> 
</body>
<script type="text/javascript">
var myApp = angular.module("myApp",['ionic']);
myApp.controller('myAppController',function($scope,$ionicPopup,$timeout){
	// Triggered on a button click, or some other target
	$scope.showPopup = function() {
		$scope.data = {}
		// 自定义弹窗
		var myPopup = $ionicPopup.show({
			template: '<input type="password" placeholder="你好！" ng-model="data.wifi">',
			title: '请输入点什么',
			subTitle: '请描述你输入的内容',
			scope: $scope,
			buttons: [
				{text: '取消'},
				{
					text: '<b>确定</b>',
					type: 'button-positive',
					onTap: function(e) {
					if (!$scope.data.wifi) {
						// 不允许用户关闭，除非输入 wifi 密码
						e.preventDefault();
					}else{
						return $scope.data.wifi;
					}
				}
			},
			]
		});
		myPopup.then(function(res) {
			console.log('你输入的是:',res);
		});
		$timeout(function() {
			myPopup.close(); // 3秒后关闭弹窗
		},5000);
	};
	//  confirm 对话框
	$scope.showConfirm = function() {
		var confirmPopup = $ionicPopup.confirm({
			title: '删除选项',
			template: '你确定要进行删除吗？',
			buttons: [
				{text: '取消'},
				{
					text: '<b>确定</b>',
					type: 'button-positive',
				}
			]
		});
		confirmPopup.then(function(res){
			if(res){
				console.log("你点击了确定！");
			}else{
				console.log("你点击了取消！");
			}
		});
	};
	// alert（警告） 对话框
	$scope.showAlert = function(){
		var alertPopup = $ionicPopup.alert({
			title: '你点击了我！',
			template: '我是你要提示的信息！'
		});
		alertPopup.then(function(res) {
			console.log("警告框点击了确定的回调");
		});
	};
});
</script>
</html>